#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int n;
struct d{
	int x;
	int y;
};
d a[100];
bool cmp (d a1, d a2){
	return a1.x < a2.x;
}
int main(){
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++)cin >> a[i].x >> a[i].y;
	sort(a, a + n, cmp);
//	for (int i = 0; i < n; i++){
//		cout << a[i].x << " " << a[i].y << endl;
//	}
	
	
	
	for (int i = 0; i < n; i++){
		for (int j = i + 1; j < n && a[j].x <= a[i].x + 1; j++){
			if (pow((a[i].x - a[j].x) ,2) + pow((a[i].y - a[j].y), 2) == 1) ans++;
		}
	}
	cout << ans << endl;

    return 0;
}


